Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sub{f}{cond4} Rd, imm

If  (cond4) then
      Rd = Rd - imm8;
      Update flags if opcode[f] field is cleared
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
d ∈ {0, 1, …, 15}
imm ∈ {-128, -127, ..., 127}

Rev2+

111101

F

11011

Rd

0000

cond4

imm8

6

1

5

4

4

4

8

2

sub{cond4} Rd, Rx, Ry

If  (cond4) then
      Rd = Rx - Ry;
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
{d, x, y} ∈ {0, 1, …, 15}

Rev2+

111

Rx

11101

Ry

1110

cond4

0001

Rd

3

4

5

4

4

4

4

4

Description

Subtracts a value from a given register and stores the result in destination register if cond4 is true.

Status Flag:

K = SE(imm8)

Flags only affected if format I and (cond4) is true and F parameter is given

Q:

Not affected

V:

V = (Rd[31] AND ~K[31] AND ~RES[31]) OR (~Rd[31] AND K[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = ~Rd[31] AND K[31] OR K[31] AND RES[31] OR RES[31] AND ~Rd[31]

Example:

subfeq R3, 5 performs R3 = R3 - 5 and sets flags accordingly if Z flag set.
subeq R5, 7 performs R5 = R5 - 5 if Z flag set. Flags are not affected.